home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 404_02 / bisnp / bison.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-16  |  23.6 KB  |  985 lines

  1. /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
  2. /* Skeleton output parser for bison,
  3.    Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
  4.  
  5.    This program is free software; you can redistribute it and/or modify
  6.    it under the terms of the GNU General Public License as published by
  7.    the Free Software Foundation; either version 1, or (at your option)
  8.    any later version.
  9.  
  10.    This program is distributed in the hope that it will be useful,
  11.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.    GNU General Public License for more details.
  14.  
  15.    You should have received a copy of the GNU General Public License
  16.    along with this program; if not, write to the Free Software
  17.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  18.  
  19. /* HEADER SECTION */
  20. #ifndef _MSDOS
  21. #ifdef MSDOS
  22. #define _MSDOS
  23. #endif
  24. #endif
  25. /* turboc */
  26. #ifdef __MSDOS__
  27. #ifndef _MSDOS
  28. #define _MSDOS
  29. #endif
  30. #endif
  31.  
  32. #ifndef alloca
  33. #if defined( __GNUC__)
  34. #define alloca __builtin_alloca
  35.  
  36. #elif (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc)  || defined (__sgi)
  37. #include <alloca.h>
  38.  
  39. #elif defined (_MSDOS)
  40. #include <malloc.h>
  41. #ifndef __TURBOC__
  42. /* MS C runtime lib */
  43. #define alloca _alloca
  44. #endif
  45.  
  46. #elif defined(_AIX)
  47. #include <malloc.h>
  48. #pragma alloca
  49.  
  50. #elif defined(__hpux)
  51. #ifdef __cplusplus
  52. extern "C" {
  53. void *alloca (unsigned int);
  54. };
  55. #else /* not __cplusplus */
  56. void *alloca ();
  57. #endif /* not __cplusplus */
  58.  
  59. #endif /* not _AIX  not MSDOS, or __TURBOC__ or _AIX, not sparc.  */
  60. #endif /* alloca not defined.  */
  61. #ifdef c_plusplus
  62. #ifndef __cplusplus
  63. #define __cplusplus
  64. #endif
  65. #endif
  66. #ifdef __cplusplus
  67. #ifndef YY_USE_CLASS
  68. #define YY_USE_CLASS
  69. #endif
  70. #else
  71. #ifndef __STDC__
  72. #define const
  73. #endif
  74. #endif
  75. #include <stdio.h>
  76. #define YYBISON 1  
  77. $/* %{ and %header{ and %union, during decl */
  78. #define YY_@_BISON 1
  79. #ifndef YY_@_COMPATIBILITY
  80. #ifndef YY_USE_CLASS
  81. #define  YY_@_COMPATIBILITY 1
  82. #else
  83. #define  YY_@_COMPATIBILITY 0
  84. #endif
  85. #endif
  86.  
  87. #if YY_@_COMPATIBILITY != 0
  88. /* backward compatibility */
  89. #ifdef YYLTYPE
  90. #ifndef YY_@_LTYPE
  91. #define YY_@_LTYPE YYLTYPE
  92. #endif
  93. #endif
  94. #ifdef YYSTYPE
  95. #ifndef YY_@_STYPE 
  96. #define YY_@_STYPE YYSTYPE
  97. #endif
  98. #endif
  99. #ifdef YYDEBUG
  100. #ifndef YY_@_DEBUG
  101. #define  YY_@_DEBUG YYDEBUG
  102. #endif
  103. #endif
  104. #ifdef YY_@_STYPE
  105. #ifndef yystype
  106. #define yystype YY_@_STYPE
  107. #endif
  108. #endif
  109. /* use goto to be compatible */
  110. #ifndef YY_@_USE_GOTO
  111. #define YY_@_USE_GOTO 1
  112. #endif
  113. #endif
  114.  
  115. /* use no goto to be clean in C++ */
  116. #ifndef YY_@_USE_GOTO
  117. #define YY_@_USE_GOTO 0
  118. #endif
  119.  
  120. #ifndef YY_@_PURE
  121. $/*  YY_@_PURE */
  122. #endif
  123.  
  124. /* section apres lecture def, avant lecture grammaire S2 */
  125. $/* prefix */
  126. #ifndef YY_@_DEBUG
  127. $/* YY_@_DEBUG */
  128. #endif
  129.  
  130.  
  131. #ifndef YY_@_LSP_NEEDED
  132. $ /* YY_@_LSP_NEEDED*/
  133. #endif
  134.  
  135.  
  136.  
  137. /* DEFAULT LTYPE*/
  138. #ifdef YY_@_LSP_NEEDED
  139. #ifndef YY_@_LTYPE
  140. typedef
  141.   struct yyltype
  142.     {
  143.       int timestamp;
  144.       int first_line;
  145.       int first_column;
  146.       int last_line;
  147.       int last_column;
  148.       char *text;
  149.    }
  150.   yyltype;
  151.  
  152. #define YY_@_LTYPE yyltype
  153. #endif
  154. #endif
  155. /* DEFAULT STYPE*/
  156.       /* We used to use `unsigned long' as YY_@_STYPE on MSDOS,
  157.      but it seems better to be consistent.
  158.      Most programs should declare their own type anyway.  */
  159.  
  160. #ifndef YY_@_STYPE
  161. #define YY_@_STYPE int
  162. #endif
  163. /* DEFAULT MISCELANEOUS */
  164. #ifndef YY_@_PARSE
  165. #define YY_@_PARSE yyparse
  166. #endif
  167. #ifndef YY_@_LEX
  168. #define YY_@_LEX yylex
  169. #endif
  170. #ifndef YY_@_LVAL
  171. #define YY_@_LVAL yylval
  172. #endif
  173. #ifndef YY_@_LLOC
  174. #define YY_@_LLOC yylloc
  175. #endif
  176. #ifndef YY_@_CHAR
  177. #define YY_@_CHAR yychar
  178. #endif
  179. #ifndef YY_@_NERRS
  180. #define YY_@_NERRS yynerrs
  181. #endif
  182. #ifndef YY_@_DEBUG_FLAG
  183. #define YY_@_DEBUG_FLAG yydebug
  184. #endif
  185. #ifndef YY_@_ERROR
  186. #define YY_@_ERROR yyerror
  187. #endif
  188. #ifndef YY_@_PARSE_PARAM
  189. #ifndef __STDC__
  190. #ifndef __cplusplus
  191. #ifndef YY_USE_CLASS
  192. #define YY_@_PARSE_PARAM
  193. #ifndef YY_@_PARSE_PARAM_DEF
  194. #define YY_@_PARSE_PARAM_DEF
  195. #endif
  196. #endif
  197. #endif
  198. #endif
  199. #ifndef YY_@_PARSE_PARAM
  200. #define YY_@_PARSE_PARAM void
  201. #endif
  202. #endif
  203. #if YY_@_COMPATIBILITY != 0
  204. /* backward compatibility */
  205. #ifdef YY_@_LTYPE
  206. #ifndef YYLTYPE
  207. #define YYLTYPE YY_@_LTYPE
  208. #else
  209. /* WARNING obsolete !!! user defined YYLTYPE not reported into generated header */
  210. #endif
  211. #endif
  212. #ifndef YYSTYPE
  213. #define YYSTYPE YY_@_STYPE
  214. #else
  215. /* WARNING obsolete !!! user defined YYSTYPE not reported into generated header */
  216. #endif
  217. #ifdef YY_@_PURE
  218. #ifndef YYPURE
  219. #define YYPURE YY_@_PURE
  220. #endif
  221. #endif
  222. #ifdef YY_@_DEBUG
  223. #ifndef YYDEBUG
  224. #define YYDEBUG YY_@_DEBUG 
  225. #endif
  226. #endif
  227. #ifndef YY_@_ERROR_VERBOSE
  228. #ifdef YYERROR_VERBOSE
  229. #define YY_@_ERROR_VERBOSE YYERROR_VERBOSE
  230. #endif
  231. #endif
  232. #ifndef YY_@_LSP_NEEDED
  233. #ifdef YYLSP_NEEDED
  234. #define YY_@_LSP_NEEDED YYLSP_NEEDED
  235. #endif
  236. #endif
  237. #endif
  238. #ifndef YY_USE_CLASS
  239. /* TOKEN C */
  240. $ /* #defines tokens */
  241. #else
  242. /* CLASS */
  243. #ifndef YY_@_CLASS
  244. #define YY_@_CLASS @
  245. #endif
  246. #ifndef YY_@_INHERIT
  247. #define YY_@_INHERIT
  248. #endif
  249. #ifndef YY_@_MEMBERS
  250. #define YY_@_MEMBERS 
  251. #endif
  252. #ifndef YY_@_LEX_BODY
  253. #define YY_@_LEX_BODY  
  254. #endif
  255. #ifndef YY_@_ERROR_BODY
  256. #define YY_@_ERROR_BODY  
  257. #endif
  258. #ifndef YY_@_CONSTRUCTOR_PARAM
  259. #define YY_@_CONSTRUCTOR_PARAM
  260. #endif
  261. #ifndef YY_@_CONSTRUCTOR_CODE
  262. #define YY_@_CONSTRUCTOR_CODE
  263. #endif
  264. #ifndef YY_@_CONSTRUCTOR_INIT
  265. #define YY_@_CONSTRUCTOR_INIT
  266. #endif
  267. /* choose between enum and const */
  268. #ifndef YY_@_USE_CONST_TOKEN
  269. #define YY_@_USE_CONST_TOKEN 0
  270. /* yes enum is more compatible with flex,  */
  271. /* so by default we use it */
  272. #endif
  273. #if YY_@_USE_CONST_TOKEN != 0
  274. #ifndef YY_@_ENUM_TOKEN
  275. #define YY_@_ENUM_TOKEN yy_@_enum_token
  276. #endif
  277. #endif
  278.  
  279. class YY_@_CLASS YY_@_INHERIT
  280. {
  281. public:
  282. #if YY_@_USE_CONST_TOKEN != 0
  283. /* static const int token ... */
  284. $ /* decl const */
  285. #else
  286. enum YY_@_ENUM_TOKEN { YY_@_NULL_TOKEN=0
  287. $ /* enum token */
  288.      }; /* end of enum declaration */
  289. #endif
  290. public:
  291.  int YY_@_PARSE (YY_@_PARSE_PARAM);
  292.  virtual void YY_@_ERROR(char *msg) YY_@_ERROR_BODY;
  293. #ifdef YY_@_PURE
  294. #ifdef YY_@_LSP_NEEDED
  295.  virtual int  YY_@_LEX (YY_@_STYPE *YY_@_LVAL,YY_@_LTYPE *YY_@_LLOC) YY_@_LEX_BODY;
  296. #else
  297.  virtual int  YY_@_LEX (YY_@_STYPE *YY_@_LVAL) YY_@_LEX_BODY;
  298. #endif
  299. #else
  300.  virtual int YY_@_LEX() YY_@_LEX_BODY;
  301.  YY_@_STYPE YY_@_LVAL;
  302. #ifdef YY_@_LSP_NEEDED
  303.  YY_@_LTYPE YY_@_LLOC;
  304. #endif
  305.  int   YY_@_NERRS;
  306.  int    YY_@_CHAR;
  307. #endif
  308. #if YY_@_DEBUG != 0
  309.  int YY_@_DEBUG_FLAG;   /*  nonzero means print parse trace     */
  310. #endif
  311. public:
  312.  YY_@_CLASS(YY_@_CONSTRUCTOR_PARAM);
  313. public:
  314.  YY_@_MEMBERS 
  315. };
  316. /* other declare folow */
  317. #if YY_@_USE_CONST_TOKEN != 0
  318. $ /* const YY_@_CLASS::token */
  319. #endif
  320. /*apres const  */
  321. YY_@_CLASS::YY_@_CLASS(YY_@_CONSTRUCTOR_PARAM) YY_@_CONSTRUCTOR_INIT
  322. {
  323. #if YY_@_DEBUG != 0
  324. YY_@_DEBUG_FLAG=0;
  325. #endif
  326. YY_@_CONSTRUCTOR_CODE;
  327. };
  328. #endif
  329. $ /* fattrs + tables */
  330.  
  331. /* parser code folow  */
  332.  
  333.  
  334. /* This is the parser code that is written into each bison parser
  335.   when the %semantic_parser declaration is not specified in the grammar.
  336.   It was written by Richard Stallman by simplifying the hairy parser
  337.   used when %semantic_parser is specified.  */
  338.  
  339. /* Note: dollar marks section change
  340.    the next  is replaced by the list of actions, each action
  341.    as one case of the switch.  */ 
  342.  
  343. #if YY_@_USE_GOTO != 0
  344. /*
  345.  SUPRESSION OF GOTO : on some C++ compiler (sun c++)
  346.   the goto is strictly forbidden if any constructor/destructor
  347.   is used in the whole function (very stupid isn't it ?)
  348.  so goto are to be replaced with a 'while/switch/case construct'
  349.  here are the macro to keep some apparent compatibility
  350. */
  351. #define YYGOTO(lb) {yy_gotostate=lb;continue;}
  352. #define YYBEGINGOTO  enum yy_labels yy_gotostate=yygotostart; \
  353.                      for(;;) switch(yy_gotostate) { case yygotostart: {
  354. #define YYLABEL(lb) } case lb: {
  355. #define YYENDGOTO } }
  356. #define YYBEGINDECLARELABEL enum yy_labels {yygotostart
  357. #define YYDECLARELABEL(lb) ,lb
  358. #define YYENDDECLARELABEL  };
  359. #else
  360. /* macro to keep goto */
  361. #define YYGOTO(lb) goto lb
  362. #define YYBEGINGOTO
  363. #define YYLABEL(lb) lb:
  364. #define YYENDGOTO
  365. #define YYBEGINDECLARELABEL
  366. #define YYDECLARELABEL(lb)
  367. #define YYENDDECLARELABEL
  368. #endif
  369. /* LABEL DECLARATION */
  370. YYBEGINDECLARELABEL
  371.   YYDECLARELABEL(yynewstate)
  372.   YYDECLARELABEL(yybackup)
  373. /* YYDECLARELABEL(yyresume) */
  374.   YYDECLARELABEL(yydefault)
  375.   YYDECLARELABEL(yyreduce)
  376.   YYDECLARELABEL(yyerrlab)   /* here on detecting error */
  377.   YYDECLARELABEL(yyerrlab1)   /* here on error raised explicitly by an action */
  378.   YYDECLARELABEL(yyerrdefault)  /* current state does not do anything special for the error token. */
  379.   YYDECLARELABEL(yyerrpop)   /* pop the current state because it cannot handle the error token */
  380.   YYDECLARELABEL(yyerrhandle)
  381. YYENDDECLARELABEL
  382.  
  383. #define yyerrok         (yyerrstatus = 0)
  384. #define yyclearin       (YY_@_CHAR = YYEMPTY)
  385. #define YYEMPTY         -2
  386. #define YYEOF           0
  387. #define YYACCEPT        return(0)
  388. #define YYABORT         return(1)
  389. #define YYERROR         YYGOTO(yyerrlab1)
  390. /* Like YYERROR except do call yyerror.
  391.    This remains here temporarily to ease the
  392.    transition to the new meaning of YYERROR, for GCC.
  393.    Once GCC version 2 has supplanted version 1, this can go.  */
  394. #define YYFAIL          YYGOTO(yyerrlab)
  395. #define YYRECOVERING()  (!!yyerrstatus)
  396. #define YYBACKUP(token, value) \
  397. do                                                              \
  398.   if (YY_@_CHAR == YYEMPTY && yylen == 1)                               \
  399.     { YY_@_CHAR = (token), YY_@_LVAL = (value);                 \
  400.       yychar1 = YYTRANSLATE (YY_@_CHAR);                                \
  401.       YYPOPSTACK;                                               \
  402.       YYGOTO(yybackup);                                            \
  403.     }                                                           \
  404.   else                                                          \
  405.     { YY_@_ERROR ("syntax error: cannot back up"); YYERROR; }   \
  406. while (0)
  407.  
  408. #define YYTERROR        1
  409. #define YYERRCODE       256
  410.  
  411. #ifndef YY_@_PURE
  412. /* UNPURE */
  413. #define YYLEX           YY_@_LEX()
  414. #ifndef YY_USE_CLASS
  415. /* If nonreentrant, and not class , generate the variables here */
  416. int     YY_@_CHAR;                      /*  the lookahead symbol        */
  417. YY_@_STYPE      YY_@_LVAL;              /*  the semantic value of the */
  418.                 /*  lookahead symbol    */
  419. int YY_@_NERRS;                 /*  number of parse errors so far */
  420. #ifdef YY_@_LSP_NEEDED
  421. YY_@_LTYPE YY_@_LLOC;   /*  location data for the lookahead     */
  422.             /*  symbol                              */
  423. #endif
  424. #endif
  425.  
  426.  
  427. #else
  428. /* PURE */
  429. #ifdef YY_@_LSP_NEEDED
  430. #define YYLEX           YY_@_LEX(&YY_@_LVAL, &YY_@_LLOC)
  431. #else
  432. #define YYLEX           YY_@_LEX(&YY_@_LVAL)
  433. #endif
  434. #endif
  435. #ifndef YY_USE_CLASS
  436. #if YY_@_DEBUG != 0
  437. int YY_@_DEBUG_FLAG;                    /*  nonzero means print parse trace     */
  438. /* Since this is uninitialized, it does not stop multiple parsers
  439.    from coexisting.  */
  440. #endif
  441. #endif
  442.  
  443.  
  444.  
  445. /*  YYINITDEPTH indicates the initial size of the parser's stacks       */
  446.  
  447. #ifndef YYINITDEPTH
  448. #define YYINITDEPTH 200
  449. #endif
  450.  
  451. /*  YYMAXDEPTH is the maximum size the stacks can grow to
  452.     (effective only if the built-in stack extension method is used).  */
  453.  
  454. #if YYMAXDEPTH == 0
  455. #undef YYMAXDEPTH
  456. #endif
  457.  
  458. #ifndef YYMAXDEPTH
  459. #define YYMAXDEPTH 10000
  460. #endif
  461.  
  462.  
  463. #if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
  464. #define __yy_bcopy(FROM,TO,COUNT)       __builtin_memcpy(TO,FROM,COUNT)
  465. #else                           /* not GNU C or C++ */
  466.  
  467. /* This is the most reliable way to avoid incompatibilities
  468.    in available built-in functions on various systems.  */
  469.  
  470. #ifdef __cplusplus
  471. static void __yy_bcopy (char *from, char *to, int count)
  472. #else
  473. #ifdef __STDC__
  474. static void __yy_bcopy (char *from, char *to, int count)
  475. #else
  476. static void __yy_bcopy (from, to, count)
  477.      char *from;
  478.      char *to;
  479.      int count;
  480. #endif
  481. #endif
  482. {
  483.   register char *f = from;
  484.   register char *t = to;
  485.   register int i = count;
  486.  
  487.   while (i-- > 0)
  488.     *t++ = *f++;
  489. }
  490. #endif
  491.  
  492. int
  493. #ifdef YY_USE_CLASS
  494.  YY_@_CLASS::
  495. #endif
  496.      YY_@_PARSE(YY_@_PARSE_PARAM)
  497. #ifndef __STDC__
  498. #ifndef __cplusplus
  499. #ifndef YY_USE_CLASS
  500. /* parameter definition without protypes */
  501. YY_@_PARSE_PARAM_DEF
  502. #endif
  503. #endif
  504. #endif
  505. {
  506.   register int yystate;
  507.   register int yyn;
  508.   register short *yyssp;
  509.   register YY_@_STYPE *yyvsp;
  510.   int yyerrstatus;      /*  number of tokens to shift before error messages enabled */
  511.   int yychar1=0;          /*  lookahead token as an internal (translated) token number */
  512.  
  513.   short yyssa[YYINITDEPTH];     /*  the state stack                     */
  514.   YY_@_STYPE yyvsa[YYINITDEPTH];        /*  the semantic value stack            */
  515.  
  516.   short *yyss = yyssa;          /*  refer to the stacks thru separate pointers */
  517.   YY_@_STYPE *yyvs = yyvsa;     /*  to allow yyoverflow to reallocate them elsewhere */
  518.  
  519. #ifdef YY_@_LSP_NEEDED
  520.   YY_@_LTYPE yylsa[YYINITDEPTH];        /*  the location stack                  */
  521.   YY_@_LTYPE *yyls = yylsa;
  522.   YY_@_LTYPE *yylsp;
  523.  
  524. #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
  525. #else
  526. #define YYPOPSTACK   (yyvsp--, yyssp--)
  527. #endif
  528.  
  529.   int yystacksize = YYINITDEPTH;
  530.  
  531. #ifdef YY_@_PURE
  532.   int YY_@_CHAR;
  533.   YY_@_STYPE YY_@_LVAL;
  534.   int YY_@_NERRS;
  535. #ifdef YY_@_LSP_NEEDED
  536.   YY_@_LTYPE YY_@_LLOC;
  537. #endif
  538. #endif
  539.  
  540.   YY_@_STYPE yyval;             /*  the variable used to return         */
  541.                 /*  semantic values from the action     */
  542.                 /*  routines                            */
  543.  
  544.   int yylen;
  545. /* start loop, in which YYGOTO may be used. */
  546. YYBEGINGOTO
  547.  
  548. #if YY_@_DEBUG != 0
  549.   if (YY_@_DEBUG_FLAG)
  550.     fprintf(stderr, "Starting parse\n");
  551. #endif
  552.   yystate = 0;
  553.   yyerrstatus = 0;
  554.   YY_@_NERRS = 0;
  555.   YY_@_CHAR = YYEMPTY;          /* Cause a token to be read.  */
  556.  
  557.   /* Initialize stack pointers.
  558.      Waste one element of value and location stack
  559.      so that they stay on the same level as the state stack.
  560.      The wasted elements are never initialized.  */
  561.  
  562.   yyssp = yyss - 1;
  563.   yyvsp = yyvs;
  564. #ifdef YY_@_LSP_NEEDED
  565.   yylsp = yyls;
  566. #endif
  567.  
  568. /* Push a new state, which is found in  yystate  .  */
  569. /* In all cases, when you get here, the value and location stacks
  570.    have just been pushed. so pushing a state here evens the stacks.  */
  571. YYLABEL(yynewstate)
  572.  
  573.   *++yyssp = yystate;
  574.  
  575.   if (yyssp >= yyss + yystacksize - 1)
  576.     {
  577.       /* Give user a chance to reallocate the stack */
  578.       /* Use copies of these so that the &'s don't force the real ones into memory. */
  579.       YY_@_STYPE *yyvs1 = yyvs;
  580.       short *yyss1 = yyss;
  581. #ifdef YY_@_LSP_NEEDED
  582.       YY_@_LTYPE *yyls1 = yyls;
  583. #endif
  584.  
  585.       /* Get the current used size of the three stacks, in elements.  */
  586.       int size = yyssp - yyss + 1;
  587.  
  588. #ifdef yyoverflow
  589.       /* Each stack pointer address is followed by the size of
  590.      the data in use in that stack, in bytes.  */
  591. #ifdef YY_@_LSP_NEEDED
  592.       /* This used to be a conditional around just the two extra args,
  593.      but that might be undefined if yyoverflow is a macro.  */
  594.       yyoverflow("parser stack overflow",
  595.          &yyss1, size * sizeof (*yyssp),
  596.          &yyvs1, size * sizeof (*yyvsp),
  597.          &yyls1, size * sizeof (*yylsp),
  598.          &yystacksize);
  599. #else
  600.       yyoverflow("parser stack overflow",
  601.          &yyss1, size * sizeof (*yyssp),
  602.          &yyvs1, size * sizeof (*yyvsp),
  603.          &yystacksize);
  604. #endif
  605.  
  606.       yyss = yyss1; yyvs = yyvs1;
  607. #ifdef YY_@_LSP_NEEDED
  608.       yyls = yyls1;
  609. #endif
  610. #else /* no yyoverflow */
  611.       /* Extend the stack our own way.  */
  612.       if (yystacksize >= YYMAXDEPTH)
  613.     {
  614.       YY_@_ERROR("parser stack overflow");
  615.       return 2;
  616.     }
  617.       yystacksize *= 2;
  618.       if (yystacksize > YYMAXDEPTH)
  619.     yystacksize = YYMAXDEPTH;
  620.       yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
  621.       __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
  622.       yyvs = (YY_@_STYPE *) alloca (yystacksize * sizeof (*yyvsp));
  623.       __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
  624. #ifdef YY_@_LSP_NEEDED
  625.       yyls = (YY_@_LTYPE *) alloca (yystacksize * sizeof (*yylsp));
  626.       __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
  627. #endif
  628. #endif /* no yyoverflow */
  629.  
  630.       yyssp = yyss + size - 1;
  631.       yyvsp = yyvs + size - 1;
  632. #ifdef YY_@_LSP_NEEDED
  633.       yylsp = yyls + size - 1;
  634. #endif
  635.  
  636. #if YY_@_DEBUG != 0
  637.       if (YY_@_DEBUG_FLAG)
  638.     fprintf(stderr, "Stack size increased to %d\n", yystacksize);
  639. #endif
  640.  
  641.       if (yyssp >= yyss + yystacksize - 1)
  642.     YYABORT;
  643.     }
  644.  
  645. #if YY_@_DEBUG != 0
  646.   if (YY_@_DEBUG_FLAG)
  647.     fprintf(stderr, "Entering state %d\n", yystate);
  648. #endif
  649.  
  650.   YYGOTO(yybackup);
  651. YYLABEL(yybackup)
  652.  
  653. /* Do appropriate processing given the current state.  */
  654. /* Read a lookahead token if we need one and don't already have one.  */
  655. /* YYLABEL(yyresume) */
  656.  
  657.   /* First try to decide what to do without reference to lookahead token.  */
  658.  
  659.   yyn = yypact[yystate];
  660.   if (yyn == YYFLAG)
  661.     YYGOTO(yydefault);
  662.  
  663.   /* Not known => get a lookahead token if don't already have one.  */
  664.  
  665.   /* yychar is either YYEMPTY or YYEOF
  666.      or a valid token in external form.  */
  667.  
  668.   if (YY_@_CHAR == YYEMPTY)
  669.     {
  670. #if YY_@_DEBUG != 0
  671.       if (YY_@_DEBUG_FLAG)
  672.     fprintf(stderr, "Reading a token: ");
  673. #endif
  674.       YY_@_CHAR = YYLEX;
  675.     }
  676.  
  677.   /* Convert token to internal form (in yychar1) for indexing tables with */
  678.  
  679.   if (YY_@_CHAR <= 0)           /* This means end of input. */
  680.     {
  681.       yychar1 = 0;
  682.       YY_@_CHAR = YYEOF;                /* Don't call YYLEX any more */
  683.  
  684. #if YY_@_DEBUG != 0
  685.       if (YY_@_DEBUG_FLAG)
  686.     fprintf(stderr, "Now at end of input.\n");
  687. #endif
  688.     }
  689.   else
  690.     {
  691.       yychar1 = YYTRANSLATE(YY_@_CHAR);
  692.  
  693. #if YY_@_DEBUG != 0
  694.       if (YY_@_DEBUG_FLAG)
  695.     {
  696.       fprintf (stderr, "Next token is %d (%s", YY_@_CHAR, yytname[yychar1]);
  697.       /* Give the individual parser a way to print the precise meaning
  698.          of a token, for further debugging info.  */
  699. #ifdef YYPRINT
  700.       YYPRINT (stderr, YY_@_CHAR, YY_@_LVAL);
  701. #endif
  702.       fprintf (stderr, ")\n");
  703.     }
  704. #endif
  705.     }
  706.  
  707.   yyn += yychar1;
  708.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  709.     YYGOTO(yydefault);
  710.  
  711.   yyn = yytable[yyn];
  712.  
  713.   /* yyn is what to do for this token type in this state.
  714.      Negative => reduce, -yyn is rule number.
  715.      Positive => shift, yyn is new state.
  716.        New state is final state => don't bother to shift,
  717.        just return success.
  718.      0, or most negative number => error.  */
  719.  
  720.   if (yyn < 0)
  721.     {
  722.       if (yyn == YYFLAG)
  723.     YYGOTO(yyerrlab);
  724.       yyn = -yyn;
  725.       YYGOTO(yyreduce);
  726.     }
  727.   else if (yyn == 0)
  728.     YYGOTO(yyerrlab);
  729.  
  730.   if (yyn == YYFINAL)
  731.     YYACCEPT;
  732.  
  733.   /* Shift the lookahead token.  */
  734.  
  735. #if YY_@_DEBUG != 0
  736.   if (YY_@_DEBUG_FLAG)
  737.     fprintf(stderr, "Shifting token %d (%s), ", YY_@_CHAR, yytname[yychar1]);
  738. #endif
  739.  
  740.   /* Discard the token being shifted unless it is eof.  */
  741.   if (YY_@_CHAR != YYEOF)
  742.     YY_@_CHAR = YYEMPTY;
  743.  
  744.   *++yyvsp = YY_@_LVAL;
  745. #ifdef YY_@_LSP_NEEDED
  746.   *++yylsp = YY_@_LLOC;
  747. #endif
  748.  
  749.   /* count tokens shifted since error; after three, turn off error status.  */
  750.   if (yyerrstatus) yyerrstatus--;
  751.  
  752.   yystate = yyn;
  753.   YYGOTO(yynewstate);
  754.  
  755. /* Do the default action for the current state.  */
  756. YYLABEL(yydefault)
  757.  
  758.   yyn = yydefact[yystate];
  759.   if (yyn == 0)
  760.     YYGOTO(yyerrlab);
  761.  
  762. /* Do a reduction.  yyn is the number of a rule to reduce with.  */
  763. YYLABEL(yyreduce)
  764.   yylen = yyr2[yyn];
  765.   if (yylen > 0)
  766.     yyval = yyvsp[1-yylen]; /* implement default value of the action */
  767.  
  768. #if YY_@_DEBUG != 0
  769.   if (YY_@_DEBUG_FLAG)
  770.     {
  771.       int i;
  772.  
  773.       fprintf (stderr, "Reducing via rule %d (line %d), ",
  774.            yyn, yyrline[yyn]);
  775.  
  776.       /* Print the symbols being reduced, and their result.  */
  777.       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
  778.     fprintf (stderr, "%s ", yytname[yyrhs[i]]);
  779.       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
  780.     }
  781. #endif
  782.  
  783. $   /* the action file gets copied in in place of this dollarsign  */
  784.   yyvsp -= yylen;
  785.   yyssp -= yylen;
  786. #ifdef YY_@_LSP_NEEDED
  787.   yylsp -= yylen;
  788. #endif
  789.  
  790. #if YY_@_DEBUG != 0
  791.   if (YY_@_DEBUG_FLAG)
  792.     {
  793.       short *ssp1 = yyss - 1;
  794.       fprintf (stderr, "state stack now");
  795.       while (ssp1 != yyssp)
  796.     fprintf (stderr, " %d", *++ssp1);
  797.       fprintf (stderr, "\n");
  798.     }
  799. #endif
  800.  
  801.   *++yyvsp = yyval;
  802.  
  803. #ifdef YY_@_LSP_NEEDED
  804.   yylsp++;
  805.   if (yylen == 0)
  806.     {
  807.       yylsp->first_line = YY_@_LLOC.first_line;
  808.       yylsp->first_column = YY_@_LLOC.first_column;
  809.       yylsp->last_line = (yylsp-1)->last_line;
  810.       yylsp->last_column = (yylsp-1)->last_column;
  811.       yylsp->text = 0;
  812.     }
  813.   else
  814.     {
  815.       yylsp->last_line = (yylsp+yylen-1)->last_line;
  816.       yylsp->last_column = (yylsp+yylen-1)->last_column;
  817.     }
  818. #endif
  819.  
  820.   /* Now "shift" the result of the reduction.
  821.      Determine what state that goes to,
  822.      based on the state we popped back to
  823.      and the rule number reduced by.  */
  824.  
  825.   yyn = yyr1[yyn];
  826.  
  827.   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  828.   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  829.     yystate = yytable[yystate];
  830.   else
  831.     yystate = yydefgoto[yyn - YYNTBASE];
  832.  
  833.   YYGOTO(yynewstate);
  834.  
  835. YYLABEL(yyerrlab)   /* here on detecting error */
  836.  
  837.   if (! yyerrstatus)
  838.     /* If not already recovering from an error, report this error.  */
  839.     {
  840.       ++YY_@_NERRS;
  841.  
  842. #ifdef YY_@_ERROR_VERBOSE
  843.       yyn = yypact[yystate];
  844.  
  845.       if (yyn > YYFLAG && yyn < YYLAST)
  846.     {
  847.       int size = 0;
  848.       char *msg;
  849.       int x, count;
  850.  
  851.       count = 0;
  852.       /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
  853.       for (x = (yyn < 0 ? -yyn : 0);
  854.            x < (sizeof(yytname) / sizeof(char *)); x++)
  855.         if (yycheck[x + yyn] == x)
  856.           size += strlen(yytname[x]) + 15, count++;
  857.       msg = (char *) malloc(size + 15);
  858.       if (msg != 0)
  859.         {
  860.           strcpy(msg, "parse error");
  861.  
  862.           if (count < 5)
  863.         {
  864.           count = 0;
  865.           for (x = (yyn < 0 ? -yyn : 0);
  866.                x < (sizeof(yytname) / sizeof(char *)); x++)
  867.             if (yycheck[x + yyn] == x)
  868.               {
  869.             strcat(msg, count == 0 ? ", expecting `" : " or `");
  870.             strcat(msg, yytname[x]);
  871.             strcat(msg, "'");
  872.             count++;
  873.               }
  874.         }
  875.           YY_@_ERROR(msg);
  876.           free(msg);
  877.         }
  878.       else
  879.         YY_@_ERROR ("parse error; also virtual memory exceeded");
  880.     }
  881.       else
  882. #endif /* YY_@_ERROR_VERBOSE */
  883.     YY_@_ERROR("parse error");
  884.     }
  885.  
  886.   YYGOTO(yyerrlab1);
  887. YYLABEL(yyerrlab1)   /* here on error raised explicitly by an action */
  888.  
  889.   if (yyerrstatus == 3)
  890.     {
  891.       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
  892.  
  893.       /* return failure if at end of input */
  894.       if (YY_@_CHAR == YYEOF)
  895.     YYABORT;
  896.  
  897. #if YY_@_DEBUG != 0
  898.       if (YY_@_DEBUG_FLAG)
  899.     fprintf(stderr, "Discarding token %d (%s).\n", YY_@_CHAR, yytname[yychar1]);
  900. #endif
  901.  
  902.       YY_@_CHAR = YYEMPTY;
  903.     }
  904.  
  905.   /* Else will try to reuse lookahead token
  906.      after shifting the error token.  */
  907.  
  908.   yyerrstatus = 3;              /* Each real token shifted decrements this */
  909.  
  910.   YYGOTO(yyerrhandle);
  911.  
  912. YYLABEL(yyerrdefault)  /* current state does not do anything special for the error token. */
  913.  
  914. #if 0
  915.   /* This is wrong; only states that explicitly want error tokens
  916.      should shift them.  */
  917.   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  918.   if (yyn) YYGOTO(yydefault);
  919. #endif
  920.  
  921. YYLABEL(yyerrpop)   /* pop the current state because it cannot handle the error token */
  922.  
  923.   if (yyssp == yyss) YYABORT;
  924.   yyvsp--;
  925.   yystate = *--yyssp;
  926. #ifdef YY_@_LSP_NEEDED
  927.   yylsp--;
  928. #endif
  929.  
  930. #if YY_@_DEBUG != 0
  931.   if (YY_@_DEBUG_FLAG)
  932.     {
  933.       short *ssp1 = yyss - 1;
  934.       fprintf (stderr, "Error: state stack now");
  935.       while (ssp1 != yyssp)
  936.     fprintf (stderr, " %d", *++ssp1);
  937.       fprintf (stderr, "\n");
  938.     }
  939. #endif
  940.  
  941. YYLABEL(yyerrhandle)
  942.  
  943.   yyn = yypact[yystate];
  944.   if (yyn == YYFLAG)
  945.     YYGOTO(yyerrdefault);
  946.  
  947.   yyn += YYTERROR;
  948.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  949.     YYGOTO(yyerrdefault);
  950.  
  951.   yyn = yytable[yyn];
  952.   if (yyn < 0)
  953.     {
  954.       if (yyn == YYFLAG)
  955.     YYGOTO(yyerrpop);
  956.       yyn = -yyn;
  957.       YYGOTO(yyreduce);
  958.     }
  959.   else if (yyn == 0)
  960.     YYGOTO(yyerrpop);
  961.  
  962.   if (yyn == YYFINAL)
  963.     YYACCEPT;
  964.  
  965. #if YY_@_DEBUG != 0
  966.   if (YY_@_DEBUG_FLAG)
  967.     fprintf(stderr, "Shifting error token, ");
  968. #endif
  969.  
  970.   *++yyvsp = YY_@_LVAL;
  971. #ifdef YY_@_LSP_NEEDED
  972.   *++yylsp = YY_@_LLOC;
  973. #endif
  974.  
  975.   yystate = yyn;
  976.   YYGOTO(yynewstate);
  977. /* end loop, in which YYGOTO may be used. */
  978.   YYENDGOTO
  979. }
  980.  
  981. /* END */
  982. $ /* section 3 */
  983.  
  984. /* AFTER END , NEVER READ !!! */
  985.